package com.qiandao.xuexitong.config;

import com.qiandao.xuexitong.service.AttendanceTaskService;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

import javax.annotation.Resource;

/**
 * 定时任务配置类
 */
@Configuration
@EnableScheduling
public class TaskConfig {
    
    @Resource
    private AttendanceTaskService attendanceTaskService;
    
    /**
     * 每分钟执行一次，更新过期签到任务状态
     */
    @Scheduled(cron = "0 * * * * ?")
    public void updateExpiredTasks() {
        attendanceTaskService.updateExpiredTasks();
    }
} 